package com.example.mall.mapper;

import com.example.mall.pojo.SpOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;

@Mapper
public interface SpOrderMapper {

    //查询订单所有列表
    @Select("select * from sp_order")
    List<SpOrder> selectAll();


//  根据订单列表的order_number订单编号模糊查询所有列表
//    select * from sp_order where order_number LIKE '%59%'
    @Select("select * from sp_order where order_number like '%${order_number}%' ")
    List<SpOrder> selectAllByQuery(String order_number);


//    根据order_id获取订单sp_order的内容
    @Select("select * from sp_order where order_id=#{order_id}")
    SpOrder selectById(Integer order_id);


    @Select("select * from sp_order where order_id=#{order_id}")
    List<SpOrder> selectOrderById(Integer order_id);

//    更新信息
//    @Update("update sp_order_goods inner join sp_order set order_id=#{order_id}, goods_id=#{goods_id},goods_price=#{goods_price}," +
//            "goods_number=#{goods_number},goods_total_price=#{goods_total_price} where  sp_order.order_id=sp_order_goods and id=#{id}}")
    @Update("update sp_order set consignee_addr=#{consignee_addr} where order_id=#{order_id} ")
    int updateById(SpOrder spOrder);

}
